//
//  ViewController.m
//  xibDemo
//
//  Created by wanglei on 17/2/4.
//  Copyright © 2017年 wanglei. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor clearColor];
    
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(10, 500, 150, 50)];
    [btn setTitle:@"点击到secVc" forState:UIControlStateNormal];
    
    [btn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:btn];
    
    
    
    UIButton *btnw = [[UIButton alloc]initWithFrame:CGRectMake(200, 500, 150, 50)];
    [btnw setTitle:@"点击到secsb" forState:UIControlStateNormal];
    
    [btnw addTarget:self action:@selector(clickBtnSecsb) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:btnw];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    
    // 使用segue传参的方法,注意这里的"hello world"可以换成本控制器的任何参数,完成将本视图的参数传递到对应控制器的过程
//    if ([segue.identifier isEqualToString:@"sec"]) {
//        SecVC *secVC = (SecVC *)segue.destinationViewController;
//        secVC.testTite = @"hello world";
//    }
    
    NSLog(@"参数传递成功了");
}

- (IBAction)testSegue:(id)sender
{
    BOOL flag = YES;
    if (flag) {
        [self performSegueWithIdentifier:@"one" sender:sender];
    } else {
        [self performSegueWithIdentifier:@"two" sender:sender];
    }
}




- (void)clickBtn {

    secVc *vc = [[secVc alloc]initWithNibName:@"secVc" bundle:[NSBundle mainBundle]];
    [self presentViewController:vc animated:YES completion:nil];
//    secsb *secone = [[UIStoryboard storyboardWithName:@"secsb" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"two"];
//    [self presentViewController:secone animated:YES completion:nil];
    
}


- (void)clickBtnSecsb {
    
        secsb *secone = [[UIStoryboard storyboardWithName:@"secsb" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"one"];
    
        [self presentViewController:secone animated:YES completion:nil];
    }

@end
